package com.zhangxin.aiInterview.service.impl;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhangxin.aiInterview.model.entity.Position;
import com.zhangxin.aiInterview.model.vo.PositionVO;
import com.zhangxin.aiInterview.model.vo.UserVO;
import com.zhangxin.aiInterview.service.PositionService;
import com.zhangxin.aiInterview.mapper.PositionMapper;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
* @author ZX
* @description 针对表【position(技术岗位表)】的数据库操作Service实现
* @createDate 2025-04-28 16:17:36
*/
@Service
public class PositionServiceImpl extends ServiceImpl<PositionMapper, Position>
    implements PositionService{

    @Override
    public PositionVO getPositionVO(Position position) {
        if (position == null) {
            return null;
        }
        PositionVO positionVO = new PositionVO();
        BeanUtils.copyProperties(position, positionVO);
        return positionVO;
    }

    @Override
    public List<PositionVO> getPositionVO(List<Position> positionList) {
        if (CollUtil.isEmpty(positionList)) {
            return new ArrayList<>();
        }
        return positionList.stream().map(this::getPositionVO).collect(Collectors.toList());
    }
}




